package com.zhang.paymentdemo.controller;

import com.zhang.paymentdemo.entity.Product;
import com.zhang.paymentdemo.service.ProductService;
import com.zhang.paymentdemo.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @ClassName ProductController
 * @Description 商品controller
 * @Author zhanghongguo
 * @Date 2022/1/7 18:59
 * @Version 1.0
 */

@Api(tags = "商品信息")
@CrossOrigin
@RestController
@RequestMapping("api/product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @ApiOperation("商品列表")
    @RequestMapping(value = "list",method = RequestMethod.GET)
    public R test(){
        List<Product> list = productService.list();
        return R.ok().data("productList",list);
    }
}
